package cn.yshujia.domain.entity;

import cn.yshujia.handler.ImgHandler;
import cn.yshujia.handler.PrefixHandler;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author YShuJia
 * @create 2024/4/23
 * @description 实体
 */

@Data
@TableName (value = "t_article", autoResultMap = true)
@Schema (name = "Article", description = "文章")
public class Article implements Serializable {
	
	@Serial
	private static final long serialVersionUID = 1L;
	
	@Schema (description = "自增主键")
	@TableId (value = "id", type = IdType.AUTO)
	private Long id;
	
	@Schema (description = "标签ID")
	@TableField ("label_id")
	private Long labelId;
	
	@Schema (description = "标题")
	@TableField ("title")
	private String title;
	
	@Schema (description = "封面")
	@TableField (value = "cover", typeHandler = PrefixHandler.class)
	private String cover;
	
	@Schema (description = "内容")
	@TableField (value = "content", typeHandler = ImgHandler.class)
	private String content;
	
	@Schema (description = "点赞量")
	@TableField ("like_count")
	private Integer likeCount;
	
	@Schema (description = "浏览量")
	@TableField ("view_count")
	private Integer viewCount;
	
	@Schema (description = "是否含有视频")
	@TableField ("has_video")
	private Boolean hasVideo;
	
	@Schema (description = "视频链接")
	@TableField ("video_url")
	private String videoUrl;
	
	@Schema (description = "文章密码")
	@TableField ("`password`")
	private String password;
	
	@Schema (description = "密码提示")
	@TableField ("tips")
	private String tips;
	
	@Schema (description = "是否推荐")
	@TableField ("is_recommend")
	private Boolean isRecommend;
	
	@Schema (description = "是否可评论")
	@TableField ("is_comment")
	private Boolean isComment;
	
	@Schema (description = "创建时间")
	@TableField (value = "create_time", fill = FieldFill.INSERT)
	@JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;
	
	@Schema (description = "更新时间")
	@TableField (value = "update_time", fill = FieldFill.INSERT_UPDATE)
	@JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date updateTime;
	
	@Schema (description = "三方来源")
	@TableField (value = "origin")
	private String origin;
	
	@Schema (description = "是否启用 1 启用 0 停用")
	@TableField ("`status`")
	private Boolean status;
}
